<template>
	<view class="content-fixed">
		<view class="status_bar" :style="'height:' + statusBarHeight + 'px;'">
			<!-- 这里是状态栏 -->
		</view>
		<view class="navbar-title">
			<view>
				<image v-if="isIcon" :src="img" @click="backTap"></image>
			</view>
			<view class="seach-box" @click="search" v-if='issIcon'>
				<image :src="imgs" v-show='issIcon'></image>
			</view>
			<view class="title-text" :style="'color:' +color">
				<image :src="imgc" v-show='iscIcon'></image>
				{{title}}
			</view>
			<view style="min-width: 100rpx;"></view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			title: String,
			isIcon: Boolean,	//返回图标
			
			issIcon:{
				type: Boolean,
				default:false
			}, 
			iscIcon:{
				type: Boolean,
				default:false
			},   //标题前图标
			color: String,
			img: {
				type: String,
				default: '/static/mine/icon-left.png'
			},
			imgc: {
				type: String,
				default: '/static/index/tuijian-icon.png'
			},
			imgs: {
				type: String,
				default: '/static/xinz/search.png'
			}
		},
		data() {
			return {
				height: 0,
				statusBarHeight: 40
			}
		},

		created() {
			const that = this
			//获取手机型号
			uni.getSystemInfo({
				success: function(res) {
					that.statusBarHeight = res.statusBarHeight //状态栏高度
					that.platform = res.platform //机型
					console.log(res)
					console.log(that.statusBarHeight)
				}
			});
		},

		methods: {
			backTap() {
				uni.navigateBack()
			},
			search(){
				uni.navigateTo({
					url:"/pages/search/search"
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content-fixed {
		width: 100%;
		// position: fixed;
		position: absolute;
		top: 0;
		z-index: 9999;
	}

	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
	}
	
	.navbar-title {
		width: 100%;
		color: #FFFFFF;
		font-size: 64upx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		view {
			image {
				width: 48upx;
				height: 48upx;
				margin-left: 34upx;
			}
		}

		.title {
			margin-left: 34upx;
		}

		.title-text {
			flex: 1;
			display: flex;
			margin-left: 30rpx;
			align-items: center;
			font-size: 48rpx;
			image{
				width: 72rpx;
				height:72rpx;
				margin-right:12rpx;
			}
		}
		.seach-box{
				border-left: rgba(255,255,255,0.5) solid 2rpx;
				height: 40rpx;
				display: flex;
				margin-left: 24rpx;
				image{
					margin-left: 24rpx;
					height: 48rpx;
					width: 48rpx;
				}
		}
	}
</style>